package com.gnerv.plug.note.toolwindow;

import com.gnerv.plug.note.data.DataCenter;
import com.gnerv.plug.note.ui.NoteToolWindow;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowFactory;
import com.intellij.ui.content.Content;
import com.intellij.ui.content.ContentFactory;
import org.jetbrains.annotations.NotNull;

public class NoteToolWindowFactory implements ToolWindowFactory {

    @Override
    public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
        DataCenter.NOTE_TOOL_WINDOW = new NoteToolWindow(project, toolWindow);
        ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
        Content content = contentFactory.createContent(DataCenter.NOTE_TOOL_WINDOW.getRootPanel(), "", false);
        toolWindow.getContentManager().addContent(content);
    }

}
